<template>
    <rx-layout>
        <div slot="center" style>
            <rx-fit>
                <div slot="toolheader" foldheader="true" foldbtn="false" border="false">
          <span class="search-btn-box">
                <span class="search-btn" @click="searchshow"><i class="iconfont iconguolv"></i>过滤</span>
           </span>
                </div>
                <div slot="searchbar" btnalign="right" v-if="fitSearch" @search="search" @cancel="cancel"
                     @close="close">
                    <a-form layout="vertical">
                        <a-form-item :label="i18n('form.boName','实体名称')">
                            <a-input :placeholder="i18n('form.boName','实体名称','input')" v-model="queryParam.Q_BO_NAME__S_LK"/>
                        </a-form-item>
                    </a-form>
                </div>
                <rx-grid
                    ref="table"
                    :allowRowSelect="true"
                    :multiSelect="true"
                    :columns="columns"
                    :defaultPageSize="10"
                    url="/api-form/form/core/formChangeLog/query"
                    :queryParam="queryParam"
                    data-field="result.data"
                    :pageSizeOptions="['10','30','40']"
                    id-field="id"
                    @selectChange="onSelectChange"
                >
                     <span slot="type" slot-scope="{ text, record }">
                          <a-tag :color="typeMap[text].color">
                            <span>{{ typeMap[text].text }}</span>
                          </a-tag>
                    </span>
                    <span slot="action" slot-scope="{ text, record }" class="actionIcons">
                        <span @click.stop="edit(record)">{{$ti18('rxList.detailBtn','明细')}}</span>
                    </span>
                </rx-grid>
            </rx-fit>
        </div>
    </rx-layout>
</template>

<script>
import FormChangeLogApi from '@/api/form/core/formChangeLog'
import FormChangeLogEdit from './FormChangeLogEdit'
import {BaseList, RxFit, RxGrid} from "@lowcode/jpaas-common-lib";

export default {
    name: 'FormChangeLogList',
    mixins: [BaseList],
    components: {
        RxFit
    },
    data() {
        return {
            columns: [
                {
                    title: this.$ti18('rxList.index','序号'),
                    type: 'indexColumn',
                    width: 100,
                    dataIndex: 'serial',
                    scopedSlots: {customRender: 'serial'}
                },
                {title: this.i18n('form.boName','实体名称'), dataIndex: 'boName', width: 100},
                {title: this.i18n('form.type','类型'), dataIndex: 'type', width: 100,scopedSlots: {customRender: 'type'}},
                {title: this.i18n('form.updateTime','变更时间'), dataIndex: 'createTime', width: 100},
                {title: this.$ti18('rxList.action','操作'), width: 100, dataIndex: 'action', scopedSlots: {customRender: 'action'}}
            ],
            component: FormChangeLogEdit,
            comment: this.i18n('list.comment','表单变更记录'),
            widthHeight: ['1000px', '700px'],
            fitSearch: false,
            typeMap: {
                'add': {color: 'green', text: this.$ti18('rxList.add','新增')},
                'upd': {color: 'blue', text: this.$ti18('rxList.update','更新')},
                'del': {color: 'red', text: this.$ti18('rxList.delBtn','删除')}
            }
        }
    },
    methods: {
        i18n(name,text,key){
            return this.$ti18(name,text,"FormChangeLog",key);
        },
        delById(ids) {
            return FormChangeLogApi.del({ids: ids.join(',')});
        },
        getListByParams(parameter) {
            return FormChangeLogApi.query(parameter)
        }

    }
}
</script>
<style scoped>

</style>

